package com.ruoyi.web.controller.student.counsellor;


import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.OperatorType;
import com.ruoyi.student.domain.vo.StudentListSearchVo;
import com.ruoyi.student.domain.vo.StudentListVo;
import com.ruoyi.student.service.IStudentBaseInfoService;
import com.ruoyi.student.service.IStudentService;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController("CounsellorStudentBaseManageController")
@RequestMapping("/counsellor/student/baseinfo")
public class CounsellorStudentBaseManageController extends BaseController {


    /**
     * 学生基础信息表操作（单表操作）
     */
    @Resource
    private IStudentBaseInfoService studentBaseInfoService;


    /**
     * 学生操作（多表操作）
     */
    @Resource
    private IStudentService studentService;

    @Resource
    private ISysUserService sysUserService;


    /**
     * 配置
     */
    @Resource
    private ISysConfigService configService;


    @Resource
    private RedisCache redisCache;

    /**
     * 获取学生列表 (辅导员端)
     *
     * @param vo
     * @return
     */
    @PreAuthorize("@ss.hasPermi('counsellor:student:baseinfo:list')")
    @Log(title = "辅导员-查询学生列表", operatorType = OperatorType.MANAGE, businessType = BusinessType.QUERY)
    @GetMapping("/counsellor/list")
    public TableDataInfo list(StudentListSearchVo vo) {
        String userName = getLoginUser().getUsername();
        vo.setCounsellorCode(userName);
        startPage();
        List<StudentListVo> list = studentService.selectStudentList(vo);
        return getDataTable(list);
    }
}
